<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<#include "/views/ftl/base/manager_include.ftl">
<script type="text/javascript" src="${basePath}js/My97DatePicker/WdatePicker.js"></script>
<base href="${basePath}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>绑定域名</title>

</head>
<body style="background:#eef3f7;">
<#include "/views/ftl/base/head.ftl"> 
<div class="Main">
  <div class="dw">
<#include "/views/ftl/base/menu.ftl">
<#function a><#return "域名绑定_List"></#function> 
<!--右边内容-->
<div class="Rightbox fl">
    <!--导航-->
    <div class="Bread_crbs clear">
      <div class="Bread_crbs_img fl"></div>
      <div class="Bread_crbs_text fl">
      	<a href="javascript:void(0);"><span>用户管理</span></a>
      	<span class="fnt_famy">></span>
      	<a href="javascript:void(0);"><span>域名绑定</span></a>
      </div>
    </div>
      <div class="Table">
        </div>
  <!--表格列表-->
        <div class="Table">
        
   
       
          <div class="input_name">
            <span class="left_title">域名：</span>
			<input type="text" name="domain" class="search_text tdd50" value="<#if domain??>${domain.domain!''}</#if>" style="width:210px;">
			
          </div> 
          
          <div class="input_name">
            <span class="left_title">网站说明：</span>
			<input type="text" name="domainExplains" class="search_text tdd50" value="<#if domain??>${domain.domainExplains!''}</#if>" style="width:210px">
          </div>
          
          <span class="tbl_btn" style="margin-left: 280px; background: #EEF3F7;"> 
          <#if domain??>
          <a href="javascript:void(0);"><span id="edit" style="background: #0075c5;">修改</span></a> 
          <#else>
          <a href="javascript:void(0);"><span id="save" style="background: #0075c5;">保存</span></a> 
          </#if>
             <a href="${basePath}manager/UserDomain_userDomainList?userId=${(userId)?c}" style="margin-left: 30px;">绑定的所有域名>></a>
          </span>
          
        </div> 
  
</div> 

<script> 
$(function(){
	//新增
	$("#save").click(function(){
		var userId='${(userId?c)!''}'; 
		var domain = $("input[name=domain]").val();
		var domainExplains = $("input[name=domainExplains]").val();
		  
		$.ajax({ 
			url : "${basePath}manager/UserDomain_bindUserDomain",
			data : { 
				userId : userId, 
				domain : domain,
				domainExplains : domainExplains,
			}, 
			dataType :"JSON",
			cache : false, 
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					alert("绑定成功");
				}else{
					alert(dat.msg);	
				} 
			}
		});
	});

	//修改
	$("#edit").click(function(){
		var id='${(domain.id?c)!''}'; 
		var domain = $("input[name=domain]").val();
		var domainExplains = $("input[name=domainExplains]").val();
		  
		$.ajax({ 
			url : "${basePath}manager/UserDomain_updateUserDomain",
			data : { 
				id : id, 
				domain : domain,
				domainExplains : domainExplains,
			}, 
			dataType :"JSON",
			cache : false, 
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					alert("修改成功");
				}else{
					alert(dat.msg);	
				} 
			}
		});
	});
});

</script>
</body>
</html>

